<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>My JSP 'upload.jsp' starting page</title>
    <script type="text/javascript">
    function addMore(){
    var td=document.getElementById("more");
    var br=document.createElement("br");
    var input=document.createElement("input");
    var button=document.createElement("input");
    input.type="file";
    input.name="file";
    button.type="button";
    button.value="删除";
    
    button.onclick=function(){
    td.removeChild(br);
    td.removeChild(input);
    td.removeChild(button);
    }
    
    td.appendChild(br);
    td.appendChild(input);
    td.appendChild(button);
    
    
    }
    </script>
  </head>
  <body>
  	<table align="center" width="40%">
			<tr>
				<td>
					<s:fielderror cssStyle="color:red;"/>
					<!--<s:actionerror cssStyle="color:red;" />-->
				</td>
			</tr>
		</table>
<s:form action="upload" theme="simple" enctype="multipart/form-data">
			<table align="center" width="60%" border="1">
				<tr>
					<td>
						用户名：
					</td>
					<td>
						<s:textfield name="username"></s:textfield>
					</td>
				</tr>
				<tr>
					<td>
						密码：
					</td>
					<td>
						<s:password name="password"></s:password>
					</td>
				</tr>
				<tr>
					<td id="">
						文件：
					</td>
					<td id="more">
						<s:file name="file"></s:file><input type="button" value="增加文件上传数目" onclick="addMore()"/>
					</td>
				</tr>
				<tr>
					<td>
						<s:submit value="注册" />
					</td>
					<td>
						<s:reset value="重置" />
					</td>
				</tr>
			</table>
		</s:form>
  </body>
</html>
